/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cw.biz;

import cw.controller.GameResultJpaController;
import cw.entity.GameResult;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author VinhTC
 */
public class GameResultBiz {
    GameResultJpaController gameResultController=new GameResultJpaController();
    public GameResultBiz() {
    }

      /**
     * method use to get hight scores
     * @param sizeId
     * @return- list object GameResult
     */
    public List<GameResult> getHightScores(int sizeId) {
        try {
            return gameResultController.getHightScores(sizeId);
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * 
     * @param result
     * @return
     */
    public boolean addResult(GameResult result){
        try {
//            int r = gameResultController.addGameResult(result);
//
//            if (r >0) {
//                return true;
//            }else{
//                return false;
//            }
            gameResultController.create(result);
            return true;
        } catch (Exception e) {
            Logger.getLogger(GameResultBiz.class.getName()).log(Level.SEVERE, null, e);
            return false;
        }
    }

}
